package com.senven.api.utils;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.senven.api.commom.ResponsePage;
import com.senven.api.commom.ResponseResult;

/**
 * 避免多次new对象
 */
/**
 * @author LQP
 */
public class ReponseResultUtil {
    /**
     * 建议传字符串
     * @param object
     * @return
     */
    public static ResponseResult success(Object object) {
        ResponseResult ResponseResult = new ResponseResult();
        ResponseResult.setCode(0);
        ResponseResult.setMsg("成功");
        ResponseResult.setData(object);
        return ResponseResult;
    }

    /**
    public static ResponseResult success() {
        return success(null);
    }**/

    /**
     *
     * @param code 状态码（我用-1）
     * @param msg 错误信息
     * @return
     */
    public static ResponseResult error(Integer code, String msg) {
        ResponseResult ResponseResult = new ResponseResult();
        ResponseResult.setCode(code);
        ResponseResult.setMsg(msg);
        return ResponseResult;
    }

}


